using UnityEngine;

public class BallShadowRenderer : MonoBehaviour
{
	protected Transform m_Shadow;

	protected Transform m_ShadowRenderer;

	protected Vector3 m_ShadowRendererLocalPosition;

	private void Awake()
	{
		m_Shadow = base.transform.Find("Shadow");
		if ((bool)m_Shadow)
		{
			m_ShadowRenderer = m_Shadow.Find("Renderer");
			m_ShadowRendererLocalPosition = m_ShadowRenderer.localPosition;
		}
	}

	public void Close()
	{
		if ((bool)m_Shadow)
		{
			m_Shadow.gameObject.SetActive(value: false);
			base.enabled = false;
		}
	}

	public void Open()
	{
		if ((bool)m_Shadow)
		{
			m_Shadow.gameObject.SetActive(value: true);
			base.enabled = true;
		}
	}

	private void LateUpdate()
	{
		if ((bool)m_Shadow)
		{
			RenderShadow();
		}
	}

	private void RenderShadow()
	{
		m_Shadow.rotation = Quaternion.identity;
		ref Vector3 shadowRendererLocalPosition = ref m_ShadowRendererLocalPosition;
		Vector3 position = base.transform.position;
		shadowRendererLocalPosition.x = (position.x - LightSource.Position.x) * 0.0015f;
		ref Vector3 shadowRendererLocalPosition2 = ref m_ShadowRendererLocalPosition;
		Vector3 position2 = base.transform.position;
		shadowRendererLocalPosition2.z = (position2.z - LightSource.Position.z) * 0.0015f;
		m_ShadowRenderer.localPosition = m_ShadowRendererLocalPosition;
	}
}
